#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1


configure: configure-stamp
	autoreconf --install --force
	cd build && ../configure --prefix=$(DEBIAN_DESTDIR)/usr --sysconfdir=$(DEBIAN_DESTDIR)/etc

configure-stamp:
	touch configure-stamp

build: build-stamp configure 
	$(MAKE) -C build all

build-stamp: configure-stamp 
	dh_testdir
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f *-stamp

	#$(MAKE) -C build clean
	rm -rf build/*

	dh_clean


DEBIAN_DESTDIR=$(CURDIR)/debian/tmp

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	$(MAKE) -C build install

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	#dh_install --sourcedir=debian/tmp --autodest --list-missing --fail-missing
	#dh_install --sourcedir=debian --autodest
	#install -d $(DEBIAN_DESTDIR)/usr/share/doc/yaru-error-graphs
	#install debian/copyright $(DEBIAN_DESTDIR)/usr/share/doc/yaru-error-graphs
	dh_installchangelogs 
	dh_link
#	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_installlogrotate
#	dh_installcron
#	dh_pysupport usr/lib/yandex/blogs
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
